package com.oa.modules.approvalsec1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.oa.common.utils.*;
import com.oa.modules.approvalsec1.dao.ProjectDao;
import com.oa.modules.approvalsec1.entity.ProjectEntity;
import com.oa.modules.approvalsec1.service.ProjectService;
import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


@Service
public class ProjectServiceImpl extends ServiceImpl<ProjectDao, ProjectEntity> implements ProjectService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        params.put("status", Constant.YES_OR_NO.YES.getValue());
        IPage page = AppUtils.getPage(new Query<ProjectEntity>(), params);
        return AppUtils.setPage(page, baseMapper.findPage(params), baseMapper.findRecords(page, params));
    }
    @Override
    public ProjectEntity getProject(String coding) {
        LambdaQueryWrapper<ProjectEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ProjectEntity::getCoding,coding);
        ProjectEntity projectEntity = getOne(lambdaQueryWrapper);
        return projectEntity;
    }

    @Override
    public PageUtils gtzzList(Map<String, Object> params) {
        params.put("status", Constant.YES_OR_NO.YES.getValue());
        IPage page = AppUtils.getPage(new Query<ProjectEntity>(), params);
        return AppUtils.setPage(page, baseMapper.gtzzPage(params), baseMapper.gtzzList(page, params));
    }


}
